//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2022 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

import Foundation
import SotoCore

extension MTurk {
    // MARK: Enums

    public enum AssignmentStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case approved = "Approved"
        case rejected = "Rejected"
        case submitted = "Submitted"
        public var description: String { return self.rawValue }
    }

    public enum Comparator: String, CustomStringConvertible, Codable, _SotoSendable {
        case doesNotExist = "DoesNotExist"
        case equalTo = "EqualTo"
        case exists = "Exists"
        case greaterThan = "GreaterThan"
        case greaterThanOrEqualTo = "GreaterThanOrEqualTo"
        case `in` = "In"
        case lessThan = "LessThan"
        case lessThanOrEqualTo = "LessThanOrEqualTo"
        case notEqualTo = "NotEqualTo"
        case notIn = "NotIn"
        public var description: String { return self.rawValue }
    }

    public enum EventType: String, CustomStringConvertible, Codable, _SotoSendable {
        case assignmentAbandoned = "AssignmentAbandoned"
        case assignmentAccepted = "AssignmentAccepted"
        case assignmentApproved = "AssignmentApproved"
        case assignmentRejected = "AssignmentRejected"
        case assignmentReturned = "AssignmentReturned"
        case assignmentSubmitted = "AssignmentSubmitted"
        case hitCreated = "HITCreated"
        case hitDisposed = "HITDisposed"
        case hitExpired = "HITExpired"
        case hitExtended = "HITExtended"
        case hitReviewable = "HITReviewable"
        case ping = "Ping"
        public var description: String { return self.rawValue }
    }

    public enum HITAccessActions: String, CustomStringConvertible, Codable, _SotoSendable {
        case accept = "Accept"
        case discoverPreviewAndAccept = "DiscoverPreviewAndAccept"
        case previewAndAccept = "PreviewAndAccept"
        public var description: String { return self.rawValue }
    }

    public enum HITReviewStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case markedForReview = "MarkedForReview"
        case notReviewed = "NotReviewed"
        case reviewedAppropriate = "ReviewedAppropriate"
        case reviewedInappropriate = "ReviewedInappropriate"
        public var description: String { return self.rawValue }
    }

    public enum HITStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case assignable = "Assignable"
        case disposed = "Disposed"
        case reviewable = "Reviewable"
        case reviewing = "Reviewing"
        case unassignable = "Unassignable"
        public var description: String { return self.rawValue }
    }

    public enum NotificationTransport: String, CustomStringConvertible, Codable, _SotoSendable {
        case email = "Email"
        case sns = "SNS"
        case sqs = "SQS"
        public var description: String { return self.rawValue }
    }

    public enum NotifyWorkersFailureCode: String, CustomStringConvertible, Codable, _SotoSendable {
        case hardFailure = "HardFailure"
        case softFailure = "SoftFailure"
        public var description: String { return self.rawValue }
    }

    public enum QualificationStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case granted = "Granted"
        case revoked = "Revoked"
        public var description: String { return self.rawValue }
    }

    public enum QualificationTypeStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case active = "Active"
        case inactive = "Inactive"
        public var description: String { return self.rawValue }
    }

    public enum ReviewActionStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case cancelled = "Cancelled"
        case failed = "Failed"
        case intended = "Intended"
        case succeeded = "Succeeded"
        public var description: String { return self.rawValue }
    }

    public enum ReviewPolicyLevel: String, CustomStringConvertible, Codable, _SotoSendable {
        case assignment = "Assignment"
        case hit = "HIT"
        public var description: String { return self.rawValue }
    }

    public enum ReviewableHITStatus: String, CustomStringConvertible, Codable, _SotoSendable {
        case reviewable = "Reviewable"
        case reviewing = "Reviewing"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct AcceptQualificationRequestRequest: AWSEncodableShape {
        ///  The value of the Qualification. You can omit this value if you are using the presence or absence of the Qualification as the basis for a HIT requirement.
        public let integerValue: Int?
        /// The ID of the Qualification request, as returned by the GetQualificationRequests operation.
        public let qualificationRequestId: String

        public init(integerValue: Int? = nil, qualificationRequestId: String) {
            self.integerValue = integerValue
            self.qualificationRequestId = qualificationRequestId
        }

        private enum CodingKeys: String, CodingKey {
            case integerValue = "IntegerValue"
            case qualificationRequestId = "QualificationRequestId"
        }
    }

    public struct AcceptQualificationRequestResponse: AWSDecodableShape {
        public init() {}
    }

    public struct ApproveAssignmentRequest: AWSEncodableShape {
        ///  The ID of the assignment. The assignment must correspond to a HIT created by the Requester.
        public let assignmentId: String
        ///  A flag indicating that an assignment should be approved even if it was previously rejected. Defaults to False.
        public let overrideRejection: Bool?
        ///  A message for the Worker, which the Worker can see in the Status section of the web site.
        public let requesterFeedback: String?

        public init(assignmentId: String, overrideRejection: Bool? = nil, requesterFeedback: String? = nil) {
            self.assignmentId = assignmentId
            self.overrideRejection = overrideRejection
            self.requesterFeedback = requesterFeedback
        }

        public func validate(name: String) throws {
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, max: 64)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, min: 1)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
            case overrideRejection = "OverrideRejection"
            case requesterFeedback = "RequesterFeedback"
        }
    }

    public struct ApproveAssignmentResponse: AWSDecodableShape {
        public init() {}
    }

    public struct Assignment: AWSDecodableShape {
        ///  The date and time the Worker accepted the assignment.
        public let acceptTime: Date?
        ///  The Worker's answers submitted for the HIT contained in a QuestionFormAnswers document, if the Worker provides an answer. If the Worker does not provide any answers, Answer may contain a QuestionFormAnswers document, or Answer may be empty.
        public let answer: String?
        ///  If the Worker has submitted results and the Requester has approved the results, ApprovalTime is the date and time the Requester approved the results. This value is omitted from the assignment if the Requester has not yet approved the results.
        public let approvalTime: Date?
        ///  A unique identifier for the assignment.
        public let assignmentId: String?
        ///  The status of the assignment.
        public let assignmentStatus: AssignmentStatus?
        ///  If results have been submitted, AutoApprovalTime is the date and time the results of the assignment results are considered Approved automatically if they have not already been explicitly approved or rejected by the Requester. This value is derived from the auto-approval delay specified by the Requester in the HIT. This value is omitted from the assignment if the Worker has not yet submitted results.
        public let autoApprovalTime: Date?
        ///  The date and time of the deadline for the assignment. This value is derived from the deadline specification for the HIT and the date and time the Worker accepted the HIT.
        public let deadline: Date?
        ///  The ID of the HIT.
        public let hitId: String?
        ///  If the Worker has submitted results and the Requester has rejected the results, RejectionTime is the date and time the Requester rejected the results.
        public let rejectionTime: Date?
        ///  The feedback string included with the call to the ApproveAssignment operation or the RejectAssignment operation, if the Requester approved or rejected the assignment and specified feedback.
        public let requesterFeedback: String?
        ///  If the Worker has submitted results, SubmitTime is the date and time the assignment was submitted. This value is omitted from the assignment if the Worker has not yet submitted results.
        public let submitTime: Date?
        ///  The ID of the Worker who accepted the HIT.
        public let workerId: String?

        public init(acceptTime: Date? = nil, answer: String? = nil, approvalTime: Date? = nil, assignmentId: String? = nil, assignmentStatus: AssignmentStatus? = nil, autoApprovalTime: Date? = nil, deadline: Date? = nil, hitId: String? = nil, rejectionTime: Date? = nil, requesterFeedback: String? = nil, submitTime: Date? = nil, workerId: String? = nil) {
            self.acceptTime = acceptTime
            self.answer = answer
            self.approvalTime = approvalTime
            self.assignmentId = assignmentId
            self.assignmentStatus = assignmentStatus
            self.autoApprovalTime = autoApprovalTime
            self.deadline = deadline
            self.hitId = hitId
            self.rejectionTime = rejectionTime
            self.requesterFeedback = requesterFeedback
            self.submitTime = submitTime
            self.workerId = workerId
        }

        private enum CodingKeys: String, CodingKey {
            case acceptTime = "AcceptTime"
            case answer = "Answer"
            case approvalTime = "ApprovalTime"
            case assignmentId = "AssignmentId"
            case assignmentStatus = "AssignmentStatus"
            case autoApprovalTime = "AutoApprovalTime"
            case deadline = "Deadline"
            case hitId = "HITId"
            case rejectionTime = "RejectionTime"
            case requesterFeedback = "RequesterFeedback"
            case submitTime = "SubmitTime"
            case workerId = "WorkerId"
        }
    }

    public struct AssociateQualificationWithWorkerRequest: AWSEncodableShape {
        /// The value of the Qualification to assign.
        public let integerValue: Int?
        /// The ID of the Qualification type to use for the assigned Qualification.
        public let qualificationTypeId: String
        ///  Specifies whether to send a notification email message to the Worker saying that the qualification was assigned to the Worker. Note: this is true by default.
        public let sendNotification: Bool?
        ///  The ID of the Worker to whom the Qualification is being assigned. Worker IDs are included with submitted HIT assignments and Qualification requests.
        public let workerId: String

        public init(integerValue: Int? = nil, qualificationTypeId: String, sendNotification: Bool? = nil, workerId: String) {
            self.integerValue = integerValue
            self.qualificationTypeId = qualificationTypeId
            self.sendNotification = sendNotification
            self.workerId = workerId
        }

        public func validate(name: String) throws {
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.workerId, name: "workerId", parent: name, max: 64)
            try self.validate(self.workerId, name: "workerId", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, pattern: "^A[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case integerValue = "IntegerValue"
            case qualificationTypeId = "QualificationTypeId"
            case sendNotification = "SendNotification"
            case workerId = "WorkerId"
        }
    }

    public struct AssociateQualificationWithWorkerResponse: AWSDecodableShape {
        public init() {}
    }

    public struct BonusPayment: AWSDecodableShape {
        /// The ID of the assignment associated with this bonus payment.
        public let assignmentId: String?
        public let bonusAmount: String?
        /// The date and time of when the bonus was granted.
        public let grantTime: Date?
        /// The Reason text given when the bonus was granted, if any.
        public let reason: String?
        /// The ID of the Worker to whom the bonus was paid.
        public let workerId: String?

        public init(assignmentId: String? = nil, bonusAmount: String? = nil, grantTime: Date? = nil, reason: String? = nil, workerId: String? = nil) {
            self.assignmentId = assignmentId
            self.bonusAmount = bonusAmount
            self.grantTime = grantTime
            self.reason = reason
            self.workerId = workerId
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
            case bonusAmount = "BonusAmount"
            case grantTime = "GrantTime"
            case reason = "Reason"
            case workerId = "WorkerId"
        }
    }

    public struct CreateAdditionalAssignmentsForHITRequest: AWSEncodableShape {
        /// The ID of the HIT to extend.
        public let hitId: String
        /// The number of additional assignments to request for this HIT.
        public let numberOfAdditionalAssignments: Int
        ///  A unique identifier for this request, which allows you to retry the call on error without extending the HIT multiple times. This is useful in cases such as network timeouts where it is unclear whether or not the call succeeded on the server. If the extend HIT already exists in the system from a previous call using the same UniqueRequestToken, subsequent calls will return an error with a message containing the request ID.
        public let uniqueRequestToken: String?

        public init(hitId: String, numberOfAdditionalAssignments: Int, uniqueRequestToken: String? = nil) {
            self.hitId = hitId
            self.numberOfAdditionalAssignments = numberOfAdditionalAssignments
            self.uniqueRequestToken = uniqueRequestToken
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, max: 64)
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case hitId = "HITId"
            case numberOfAdditionalAssignments = "NumberOfAdditionalAssignments"
            case uniqueRequestToken = "UniqueRequestToken"
        }
    }

    public struct CreateAdditionalAssignmentsForHITResponse: AWSDecodableShape {
        public init() {}
    }

    public struct CreateHITRequest: AWSEncodableShape {
        ///  The amount of time, in seconds, that a Worker has to complete the HIT after accepting it. If a Worker does not complete the assignment within the specified duration, the assignment is considered abandoned. If the HIT is still active (that is, its lifetime has not elapsed), the assignment becomes available for other users to find and accept.
        public let assignmentDurationInSeconds: Int64
        ///  The Assignment-level Review Policy applies to the assignments under the HIT. You can specify for Mechanical Turk to take various actions based on the policy.
        public let assignmentReviewPolicy: ReviewPolicy?
        ///  The number of seconds after an assignment for the HIT has been submitted, after which the assignment is considered Approved automatically unless the Requester explicitly rejects it.
        public let autoApprovalDelayInSeconds: Int64?
        ///  A general description of the HIT. A description includes detailed information about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT description appears in the expanded view of search results, and in the HIT and assignment screens. A good description gives the user enough information to evaluate the HIT before accepting it.
        public let description: String
        ///  The HITLayoutId allows you to use a pre-existing HIT design with placeholder values and create an additional HIT by providing those values as HITLayoutParameters.   Constraints: Either a Question parameter or a HITLayoutId parameter must be provided.
        public let hitLayoutId: String?
        ///  If the HITLayoutId is provided, any placeholder values must be filled in with values using the HITLayoutParameter structure. For more information, see HITLayout.
        public let hitLayoutParameters: [HITLayoutParameter]?
        ///  The HIT-level Review Policy applies to the HIT. You can specify for Mechanical Turk to take various actions based on the policy.
        public let hitReviewPolicy: ReviewPolicy?
        ///  One or more words or phrases that describe the HIT, separated by commas. These words are used in searches to find HITs.
        public let keywords: String?
        ///  An amount of time, in seconds, after which the HIT is no longer available for users to accept. After the lifetime of the HIT elapses, the HIT no longer appears in HIT searches, even if not all of the assignments for the HIT have been accepted.
        public let lifetimeInSeconds: Int64
        ///  The number of times the HIT can be accepted and completed before the HIT becomes unavailable.
        public let maxAssignments: Int?
        ///  Conditions that a Worker's Qualifications must meet in order to accept the HIT. A HIT can have between zero and ten Qualification requirements. All requirements must be met in order for a Worker to accept the HIT. Additionally, other actions can be restricted using the ActionsGuarded field on each QualificationRequirement structure.
        public let qualificationRequirements: [QualificationRequirement]?
        ///  The data the person completing the HIT uses to produce the results.   Constraints: Must be a QuestionForm data structure, an ExternalQuestion data structure, or an HTMLQuestion data structure. The XML question data must not be larger than 64 kilobytes (65,535 bytes) in size, including whitespace.  Either a Question parameter or a HITLayoutId parameter must be provided.
        public let question: String?
        ///  An arbitrary data field. The RequesterAnnotation parameter lets your application attach arbitrary data to the HIT for tracking purposes. For example, this parameter could be an identifier internal to the Requester's application that corresponds with the HIT.   The RequesterAnnotation parameter for a HIT is only visible to the Requester who created the HIT. It is not shown to the Worker, or any other Requester.   The RequesterAnnotation parameter may be different for each HIT you submit. It does not affect how your HITs are grouped.
        public let requesterAnnotation: String?
        ///  The amount of money the Requester will pay a Worker for successfully completing the HIT.
        public let reward: String
        ///  The title of the HIT. A title should be short and descriptive about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT title appears in search results, and everywhere the HIT is mentioned.
        public let title: String
        ///  A unique identifier for this request which allows you to retry the call on error without creating duplicate HITs. This is useful in cases such as network timeouts where it is unclear whether or not the call succeeded on the server. If the HIT already exists in the system from a previous call using the same UniqueRequestToken, subsequent calls will return a AWS.MechanicalTurk.HitAlreadyExists error with a message containing the HITId.    Note: It is your responsibility to ensure uniqueness of the token. The unique token expires after 24 hours. Subsequent calls using the same UniqueRequestToken made after the 24 hour limit could create duplicate HITs.
        public let uniqueRequestToken: String?

        public init(assignmentDurationInSeconds: Int64, assignmentReviewPolicy: ReviewPolicy? = nil, autoApprovalDelayInSeconds: Int64? = nil, description: String, hitLayoutId: String? = nil, hitLayoutParameters: [HITLayoutParameter]? = nil, hitReviewPolicy: ReviewPolicy? = nil, keywords: String? = nil, lifetimeInSeconds: Int64, maxAssignments: Int? = nil, qualificationRequirements: [QualificationRequirement]? = nil, question: String? = nil, requesterAnnotation: String? = nil, reward: String, title: String, uniqueRequestToken: String? = nil) {
            self.assignmentDurationInSeconds = assignmentDurationInSeconds
            self.assignmentReviewPolicy = assignmentReviewPolicy
            self.autoApprovalDelayInSeconds = autoApprovalDelayInSeconds
            self.description = description
            self.hitLayoutId = hitLayoutId
            self.hitLayoutParameters = hitLayoutParameters
            self.hitReviewPolicy = hitReviewPolicy
            self.keywords = keywords
            self.lifetimeInSeconds = lifetimeInSeconds
            self.maxAssignments = maxAssignments
            self.qualificationRequirements = qualificationRequirements
            self.question = question
            self.requesterAnnotation = requesterAnnotation
            self.reward = reward
            self.title = title
            self.uniqueRequestToken = uniqueRequestToken
        }

        public func validate(name: String) throws {
            try self.validate(self.hitLayoutId, name: "hitLayoutId", parent: name, max: 64)
            try self.validate(self.hitLayoutId, name: "hitLayoutId", parent: name, min: 1)
            try self.validate(self.hitLayoutId, name: "hitLayoutId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.qualificationRequirements?.forEach {
                try $0.validate(name: "\(name).qualificationRequirements[]")
            }
            try self.validate(self.reward, name: "reward", parent: name, pattern: "^[0-9]+(\\.)?[0-9]{0,2}$")
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, max: 64)
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentDurationInSeconds = "AssignmentDurationInSeconds"
            case assignmentReviewPolicy = "AssignmentReviewPolicy"
            case autoApprovalDelayInSeconds = "AutoApprovalDelayInSeconds"
            case description = "Description"
            case hitLayoutId = "HITLayoutId"
            case hitLayoutParameters = "HITLayoutParameters"
            case hitReviewPolicy = "HITReviewPolicy"
            case keywords = "Keywords"
            case lifetimeInSeconds = "LifetimeInSeconds"
            case maxAssignments = "MaxAssignments"
            case qualificationRequirements = "QualificationRequirements"
            case question = "Question"
            case requesterAnnotation = "RequesterAnnotation"
            case reward = "Reward"
            case title = "Title"
            case uniqueRequestToken = "UniqueRequestToken"
        }
    }

    public struct CreateHITResponse: AWSDecodableShape {
        ///  Contains the newly created HIT data. For a description of the HIT data structure as it appears in responses, see the HIT Data Structure documentation.
        public let hit: HIT?

        public init(hit: HIT? = nil) {
            self.hit = hit
        }

        private enum CodingKeys: String, CodingKey {
            case hit = "HIT"
        }
    }

    public struct CreateHITTypeRequest: AWSEncodableShape {
        ///  The amount of time, in seconds, that a Worker has to complete the HIT after accepting it. If a Worker does not complete the assignment within the specified duration, the assignment is considered abandoned. If the HIT is still active (that is, its lifetime has not elapsed), the assignment becomes available for other users to find and accept.
        public let assignmentDurationInSeconds: Int64
        ///  The number of seconds after an assignment for the HIT has been submitted, after which the assignment is considered Approved automatically unless the Requester explicitly rejects it.
        public let autoApprovalDelayInSeconds: Int64?
        ///  A general description of the HIT. A description includes detailed information about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT description appears in the expanded view of search results, and in the HIT and assignment screens. A good description gives the user enough information to evaluate the HIT before accepting it.
        public let description: String
        ///  One or more words or phrases that describe the HIT, separated by commas. These words are used in searches to find HITs.
        public let keywords: String?
        ///  Conditions that a Worker's Qualifications must meet in order to accept the HIT. A HIT can have between zero and ten Qualification requirements. All requirements must be met in order for a Worker to accept the HIT. Additionally, other actions can be restricted using the ActionsGuarded field on each QualificationRequirement structure.
        public let qualificationRequirements: [QualificationRequirement]?
        ///  The amount of money the Requester will pay a Worker for successfully completing the HIT.
        public let reward: String
        ///  The title of the HIT. A title should be short and descriptive about the kind of task the HIT contains. On the Amazon Mechanical Turk web site, the HIT title appears in search results, and everywhere the HIT is mentioned.
        public let title: String

        public init(assignmentDurationInSeconds: Int64, autoApprovalDelayInSeconds: Int64? = nil, description: String, keywords: String? = nil, qualificationRequirements: [QualificationRequirement]? = nil, reward: String, title: String) {
            self.assignmentDurationInSeconds = assignmentDurationInSeconds
            self.autoApprovalDelayInSeconds = autoApprovalDelayInSeconds
            self.description = description
            self.keywords = keywords
            self.qualificationRequirements = qualificationRequirements
            self.reward = reward
            self.title = title
        }

        public func validate(name: String) throws {
            try self.qualificationRequirements?.forEach {
                try $0.validate(name: "\(name).qualificationRequirements[]")
            }
            try self.validate(self.reward, name: "reward", parent: name, pattern: "^[0-9]+(\\.)?[0-9]{0,2}$")
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentDurationInSeconds = "AssignmentDurationInSeconds"
            case autoApprovalDelayInSeconds = "AutoApprovalDelayInSeconds"
            case description = "Description"
            case keywords = "Keywords"
            case qualificationRequirements = "QualificationRequirements"
            case reward = "Reward"
            case title = "Title"
        }
    }

    public struct CreateHITTypeResponse: AWSDecodableShape {
        ///  The ID of the newly registered HIT type.
        public let hitTypeId: String?

        public init(hitTypeId: String? = nil) {
            self.hitTypeId = hitTypeId
        }

        private enum CodingKeys: String, CodingKey {
            case hitTypeId = "HITTypeId"
        }
    }

    public struct CreateHITWithHITTypeRequest: AWSEncodableShape {
        ///  The Assignment-level Review Policy applies to the assignments under the HIT. You can specify for Mechanical Turk to take various actions based on the policy.
        public let assignmentReviewPolicy: ReviewPolicy?
        ///  The HITLayoutId allows you to use a pre-existing HIT design with placeholder values and create an additional HIT by providing those values as HITLayoutParameters.   Constraints: Either a Question parameter or a HITLayoutId parameter must be provided.
        public let hitLayoutId: String?
        ///  If the HITLayoutId is provided, any placeholder values must be filled in with values using the HITLayoutParameter structure. For more information, see HITLayout.
        public let hitLayoutParameters: [HITLayoutParameter]?
        ///  The HIT-level Review Policy applies to the HIT. You can specify for Mechanical Turk to take various actions based on the policy.
        public let hitReviewPolicy: ReviewPolicy?
        /// The HIT type ID you want to create this HIT with.
        public let hitTypeId: String
        ///  An amount of time, in seconds, after which the HIT is no longer available for users to accept. After the lifetime of the HIT elapses, the HIT no longer appears in HIT searches, even if not all of the assignments for the HIT have been accepted.
        public let lifetimeInSeconds: Int64
        ///  The number of times the HIT can be accepted and completed before the HIT becomes unavailable.
        public let maxAssignments: Int?
        ///  The data the person completing the HIT uses to produce the results.   Constraints: Must be a QuestionForm data structure, an ExternalQuestion data structure, or an HTMLQuestion data structure. The XML question data must not be larger than 64 kilobytes (65,535 bytes) in size, including whitespace.  Either a Question parameter or a HITLayoutId parameter must be provided.
        public let question: String?
        ///  An arbitrary data field. The RequesterAnnotation parameter lets your application attach arbitrary data to the HIT for tracking purposes. For example, this parameter could be an identifier internal to the Requester's application that corresponds with the HIT.   The RequesterAnnotation parameter for a HIT is only visible to the Requester who created the HIT. It is not shown to the Worker, or any other Requester.   The RequesterAnnotation parameter may be different for each HIT you submit. It does not affect how your HITs are grouped.
        public let requesterAnnotation: String?
        ///  A unique identifier for this request which allows you to retry the call on error without creating duplicate HITs. This is useful in cases such as network timeouts where it is unclear whether or not the call succeeded on the server. If the HIT already exists in the system from a previous call using the same UniqueRequestToken, subsequent calls will return a AWS.MechanicalTurk.HitAlreadyExists error with a message containing the HITId.    Note: It is your responsibility to ensure uniqueness of the token. The unique token expires after 24 hours. Subsequent calls using the same UniqueRequestToken made after the 24 hour limit could create duplicate HITs.
        public let uniqueRequestToken: String?

        public init(assignmentReviewPolicy: ReviewPolicy? = nil, hitLayoutId: String? = nil, hitLayoutParameters: [HITLayoutParameter]? = nil, hitReviewPolicy: ReviewPolicy? = nil, hitTypeId: String, lifetimeInSeconds: Int64, maxAssignments: Int? = nil, question: String? = nil, requesterAnnotation: String? = nil, uniqueRequestToken: String? = nil) {
            self.assignmentReviewPolicy = assignmentReviewPolicy
            self.hitLayoutId = hitLayoutId
            self.hitLayoutParameters = hitLayoutParameters
            self.hitReviewPolicy = hitReviewPolicy
            self.hitTypeId = hitTypeId
            self.lifetimeInSeconds = lifetimeInSeconds
            self.maxAssignments = maxAssignments
            self.question = question
            self.requesterAnnotation = requesterAnnotation
            self.uniqueRequestToken = uniqueRequestToken
        }

        public func validate(name: String) throws {
            try self.validate(self.hitLayoutId, name: "hitLayoutId", parent: name, max: 64)
            try self.validate(self.hitLayoutId, name: "hitLayoutId", parent: name, min: 1)
            try self.validate(self.hitLayoutId, name: "hitLayoutId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, max: 64)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, min: 1)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, max: 64)
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentReviewPolicy = "AssignmentReviewPolicy"
            case hitLayoutId = "HITLayoutId"
            case hitLayoutParameters = "HITLayoutParameters"
            case hitReviewPolicy = "HITReviewPolicy"
            case hitTypeId = "HITTypeId"
            case lifetimeInSeconds = "LifetimeInSeconds"
            case maxAssignments = "MaxAssignments"
            case question = "Question"
            case requesterAnnotation = "RequesterAnnotation"
            case uniqueRequestToken = "UniqueRequestToken"
        }
    }

    public struct CreateHITWithHITTypeResponse: AWSDecodableShape {
        ///  Contains the newly created HIT data. For a description of the HIT data structure as it appears in responses, see the HIT Data Structure documentation.
        public let hit: HIT?

        public init(hit: HIT? = nil) {
            self.hit = hit
        }

        private enum CodingKeys: String, CodingKey {
            case hit = "HIT"
        }
    }

    public struct CreateQualificationTypeRequest: AWSEncodableShape {
        /// The answers to the Qualification test specified in the Test parameter, in the form of an AnswerKey data structure. Constraints: Must not be longer than 65535 bytes. Constraints: None. If not specified, you must process Qualification requests manually.
        public let answerKey: String?
        /// Specifies whether requests for the Qualification type are granted immediately, without prompting the Worker with a Qualification test. Constraints: If the Test parameter is specified, this parameter cannot be true.
        public let autoGranted: Bool?
        /// The Qualification value to use for automatically granted Qualifications. This parameter is used only if the AutoGranted parameter is true.
        public let autoGrantedValue: Int?
        /// A long description for the Qualification type. On the Amazon Mechanical Turk website, the long description is displayed when a Worker examines a Qualification type.
        public let description: String
        /// One or more words or phrases that describe the Qualification type, separated by commas. The keywords of a type make the type easier to find during a search.
        public let keywords: String?
        ///  The name you give to the Qualification type. The type name is used to represent the Qualification to Workers, and to find the type using a Qualification type search. It must be unique across all of your Qualification types.
        public let name: String
        /// The initial status of the Qualification type. Constraints: Valid values are: Active | Inactive
        public let qualificationTypeStatus: QualificationTypeStatus
        /// The number of seconds that a Worker must wait after requesting a Qualification of the Qualification type before the worker can retry the Qualification request. Constraints: None. If not specified, retries are disabled and Workers can request a Qualification of this type only once, even if the Worker has not been granted the Qualification. It is not possible to disable retries for a Qualification type after it has been created with retries enabled. If you want to disable retries, you must delete existing retry-enabled Qualification type and then create a new Qualification type with retries disabled.
        public let retryDelayInSeconds: Int64?
        ///  The questions for the Qualification test a Worker must answer correctly to obtain a Qualification of this type. If this parameter is specified, TestDurationInSeconds must also be specified.  Constraints: Must not be longer than 65535 bytes. Must be a QuestionForm data structure. This parameter cannot be specified if AutoGranted is true. Constraints: None. If not specified, the Worker may request the Qualification without answering any questions.
        public let test: String?
        /// The number of seconds the Worker has to complete the Qualification test, starting from the time the Worker requests the Qualification.
        public let testDurationInSeconds: Int64?

        public init(answerKey: String? = nil, autoGranted: Bool? = nil, autoGrantedValue: Int? = nil, description: String, keywords: String? = nil, name: String, qualificationTypeStatus: QualificationTypeStatus, retryDelayInSeconds: Int64? = nil, test: String? = nil, testDurationInSeconds: Int64? = nil) {
            self.answerKey = answerKey
            self.autoGranted = autoGranted
            self.autoGrantedValue = autoGrantedValue
            self.description = description
            self.keywords = keywords
            self.name = name
            self.qualificationTypeStatus = qualificationTypeStatus
            self.retryDelayInSeconds = retryDelayInSeconds
            self.test = test
            self.testDurationInSeconds = testDurationInSeconds
        }

        private enum CodingKeys: String, CodingKey {
            case answerKey = "AnswerKey"
            case autoGranted = "AutoGranted"
            case autoGrantedValue = "AutoGrantedValue"
            case description = "Description"
            case keywords = "Keywords"
            case name = "Name"
            case qualificationTypeStatus = "QualificationTypeStatus"
            case retryDelayInSeconds = "RetryDelayInSeconds"
            case test = "Test"
            case testDurationInSeconds = "TestDurationInSeconds"
        }
    }

    public struct CreateQualificationTypeResponse: AWSDecodableShape {
        /// The created Qualification type, returned as a QualificationType data structure.
        public let qualificationType: QualificationType?

        public init(qualificationType: QualificationType? = nil) {
            self.qualificationType = qualificationType
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationType = "QualificationType"
        }
    }

    public struct CreateWorkerBlockRequest: AWSEncodableShape {
        /// A message explaining the reason for blocking the Worker. This parameter enables you to keep track of your Workers. The Worker does not see this message.
        public let reason: String
        /// The ID of the Worker to block.
        public let workerId: String

        public init(reason: String, workerId: String) {
            self.reason = reason
            self.workerId = workerId
        }

        public func validate(name: String) throws {
            try self.validate(self.workerId, name: "workerId", parent: name, max: 64)
            try self.validate(self.workerId, name: "workerId", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, pattern: "^A[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case reason = "Reason"
            case workerId = "WorkerId"
        }
    }

    public struct CreateWorkerBlockResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteHITRequest: AWSEncodableShape {
        /// The ID of the HIT to be deleted.
        public let hitId: String

        public init(hitId: String) {
            self.hitId = hitId
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case hitId = "HITId"
        }
    }

    public struct DeleteHITResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteQualificationTypeRequest: AWSEncodableShape {
        /// The ID of the QualificationType to dispose.
        public let qualificationTypeId: String

        public init(qualificationTypeId: String) {
            self.qualificationTypeId = qualificationTypeId
        }

        public func validate(name: String) throws {
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationTypeId = "QualificationTypeId"
        }
    }

    public struct DeleteQualificationTypeResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DeleteWorkerBlockRequest: AWSEncodableShape {
        /// A message that explains the reason for unblocking the Worker. The Worker does not see this message.
        public let reason: String?
        /// The ID of the Worker to unblock.
        public let workerId: String

        public init(reason: String? = nil, workerId: String) {
            self.reason = reason
            self.workerId = workerId
        }

        public func validate(name: String) throws {
            try self.validate(self.workerId, name: "workerId", parent: name, max: 64)
            try self.validate(self.workerId, name: "workerId", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, pattern: "^A[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case reason = "Reason"
            case workerId = "WorkerId"
        }
    }

    public struct DeleteWorkerBlockResponse: AWSDecodableShape {
        public init() {}
    }

    public struct DisassociateQualificationFromWorkerRequest: AWSEncodableShape {
        /// The ID of the Qualification type of the Qualification to be revoked.
        public let qualificationTypeId: String
        /// A text message that explains why the Qualification was revoked. The user who had the Qualification sees this message.
        public let reason: String?
        /// The ID of the Worker who possesses the Qualification to be revoked.
        public let workerId: String

        public init(qualificationTypeId: String, reason: String? = nil, workerId: String) {
            self.qualificationTypeId = qualificationTypeId
            self.reason = reason
            self.workerId = workerId
        }

        public func validate(name: String) throws {
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.workerId, name: "workerId", parent: name, max: 64)
            try self.validate(self.workerId, name: "workerId", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, pattern: "^A[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationTypeId = "QualificationTypeId"
            case reason = "Reason"
            case workerId = "WorkerId"
        }
    }

    public struct DisassociateQualificationFromWorkerResponse: AWSDecodableShape {
        public init() {}
    }

    public struct GetAccountBalanceRequest: AWSEncodableShape {
        public init() {}
    }

    public struct GetAccountBalanceResponse: AWSDecodableShape {
        public let availableBalance: String?
        public let onHoldBalance: String?

        public init(availableBalance: String? = nil, onHoldBalance: String? = nil) {
            self.availableBalance = availableBalance
            self.onHoldBalance = onHoldBalance
        }

        private enum CodingKeys: String, CodingKey {
            case availableBalance = "AvailableBalance"
            case onHoldBalance = "OnHoldBalance"
        }
    }

    public struct GetAssignmentRequest: AWSEncodableShape {
        /// The ID of the Assignment to be retrieved.
        public let assignmentId: String

        public init(assignmentId: String) {
            self.assignmentId = assignmentId
        }

        public func validate(name: String) throws {
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, max: 64)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, min: 1)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
        }
    }

    public struct GetAssignmentResponse: AWSDecodableShape {
        ///  The assignment. The response includes one Assignment element.
        public let assignment: Assignment?
        ///  The HIT associated with this assignment. The response includes one HIT element.
        public let hit: HIT?

        public init(assignment: Assignment? = nil, hit: HIT? = nil) {
            self.assignment = assignment
            self.hit = hit
        }

        private enum CodingKeys: String, CodingKey {
            case assignment = "Assignment"
            case hit = "HIT"
        }
    }

    public struct GetFileUploadURLRequest: AWSEncodableShape {
        /// The ID of the assignment that contains the question with a FileUploadAnswer.
        public let assignmentId: String
        /// The identifier of the question with a FileUploadAnswer, as specified in the QuestionForm of the HIT.
        public let questionIdentifier: String

        public init(assignmentId: String, questionIdentifier: String) {
            self.assignmentId = assignmentId
            self.questionIdentifier = questionIdentifier
        }

        public func validate(name: String) throws {
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, max: 64)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, min: 1)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
            case questionIdentifier = "QuestionIdentifier"
        }
    }

    public struct GetFileUploadURLResponse: AWSDecodableShape {
        ///  A temporary URL for the file that the Worker uploaded for the answer.
        public let fileUploadURL: String?

        public init(fileUploadURL: String? = nil) {
            self.fileUploadURL = fileUploadURL
        }

        private enum CodingKeys: String, CodingKey {
            case fileUploadURL = "FileUploadURL"
        }
    }

    public struct GetHITRequest: AWSEncodableShape {
        /// The ID of the HIT to be retrieved.
        public let hitId: String

        public init(hitId: String) {
            self.hitId = hitId
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case hitId = "HITId"
        }
    }

    public struct GetHITResponse: AWSDecodableShape {
        ///  Contains the requested HIT data.
        public let hit: HIT?

        public init(hit: HIT? = nil) {
            self.hit = hit
        }

        private enum CodingKeys: String, CodingKey {
            case hit = "HIT"
        }
    }

    public struct GetQualificationScoreRequest: AWSEncodableShape {
        /// The ID of the QualificationType.
        public let qualificationTypeId: String
        /// The ID of the Worker whose Qualification is being updated.
        public let workerId: String

        public init(qualificationTypeId: String, workerId: String) {
            self.qualificationTypeId = qualificationTypeId
            self.workerId = workerId
        }

        public func validate(name: String) throws {
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.workerId, name: "workerId", parent: name, max: 64)
            try self.validate(self.workerId, name: "workerId", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, pattern: "^A[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationTypeId = "QualificationTypeId"
            case workerId = "WorkerId"
        }
    }

    public struct GetQualificationScoreResponse: AWSDecodableShape {
        ///  The Qualification data structure of the Qualification assigned to a user, including the Qualification type and the value (score).
        public let qualification: Qualification?

        public init(qualification: Qualification? = nil) {
            self.qualification = qualification
        }

        private enum CodingKeys: String, CodingKey {
            case qualification = "Qualification"
        }
    }

    public struct GetQualificationTypeRequest: AWSEncodableShape {
        /// The ID of the QualificationType.
        public let qualificationTypeId: String

        public init(qualificationTypeId: String) {
            self.qualificationTypeId = qualificationTypeId
        }

        public func validate(name: String) throws {
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationTypeId = "QualificationTypeId"
        }
    }

    public struct GetQualificationTypeResponse: AWSDecodableShape {
        ///  The returned Qualification Type
        public let qualificationType: QualificationType?

        public init(qualificationType: QualificationType? = nil) {
            self.qualificationType = qualificationType
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationType = "QualificationType"
        }
    }

    public struct HIT: AWSDecodableShape {
        ///  The length of time, in seconds, that a Worker has to complete the HIT after accepting it.
        public let assignmentDurationInSeconds: Int64?
        /// The amount of time, in seconds, after the Worker submits an assignment for the HIT that the results are automatically approved by Amazon Mechanical Turk. This is the amount of time the Requester has to reject an assignment submitted by a Worker before the assignment is auto-approved and the Worker is paid.
        public let autoApprovalDelayInSeconds: Int64?
        ///  The date and time the HIT was created.
        public let creationTime: Date?
        ///  A general description of the HIT.
        public let description: String?
        /// The date and time the HIT expires.
        public let expiration: Date?
        ///  The ID of the HIT Group of this HIT.
        public let hitGroupId: String?
        ///  A unique identifier for the HIT.
        public let hitId: String?
        ///  The ID of the HIT Layout of this HIT.
        public let hitLayoutId: String?
        ///  Indicates the review status of the HIT. Valid Values are NotReviewed | MarkedForReview | ReviewedAppropriate | ReviewedInappropriate.
        public let hitReviewStatus: HITReviewStatus?
        /// The status of the HIT and its assignments. Valid Values are Assignable | Unassignable | Reviewable | Reviewing | Disposed.
        public let hitStatus: HITStatus?
        /// The ID of the HIT type of this HIT
        public let hitTypeId: String?
        ///  One or more words or phrases that describe the HIT, separated by commas. Search terms similar to the keywords of a HIT are more likely to have the HIT in the search results.
        public let keywords: String?
        /// The number of times the HIT can be accepted and completed before the HIT becomes unavailable.
        public let maxAssignments: Int?
        ///  The number of assignments for this HIT that are available for Workers to accept.
        public let numberOfAssignmentsAvailable: Int?
        ///  The number of assignments for this HIT that have been approved or rejected.
        public let numberOfAssignmentsCompleted: Int?
        ///  The number of assignments for this HIT that are being previewed or have been accepted by Workers, but have not yet been submitted, returned, or abandoned.
        public let numberOfAssignmentsPending: Int?
        ///  Conditions that a Worker's Qualifications must meet in order to accept the HIT. A HIT can have between zero and ten Qualification requirements. All requirements must be met in order for a Worker to accept the HIT. Additionally, other actions can be restricted using the ActionsGuarded field on each QualificationRequirement structure.
        public let qualificationRequirements: [QualificationRequirement]?
        ///  The data the Worker completing the HIT uses produce the results. This is either either a QuestionForm, HTMLQuestion or an ExternalQuestion data structure.
        public let question: String?
        ///  An arbitrary data field the Requester who created the HIT can use. This field is visible only to the creator of the HIT.
        public let requesterAnnotation: String?
        public let reward: String?
        ///  The title of the HIT.
        public let title: String?

        public init(assignmentDurationInSeconds: Int64? = nil, autoApprovalDelayInSeconds: Int64? = nil, creationTime: Date? = nil, description: String? = nil, expiration: Date? = nil, hitGroupId: String? = nil, hitId: String? = nil, hitLayoutId: String? = nil, hitReviewStatus: HITReviewStatus? = nil, hitStatus: HITStatus? = nil, hitTypeId: String? = nil, keywords: String? = nil, maxAssignments: Int? = nil, numberOfAssignmentsAvailable: Int? = nil, numberOfAssignmentsCompleted: Int? = nil, numberOfAssignmentsPending: Int? = nil, qualificationRequirements: [QualificationRequirement]? = nil, question: String? = nil, requesterAnnotation: String? = nil, reward: String? = nil, title: String? = nil) {
            self.assignmentDurationInSeconds = assignmentDurationInSeconds
            self.autoApprovalDelayInSeconds = autoApprovalDelayInSeconds
            self.creationTime = creationTime
            self.description = description
            self.expiration = expiration
            self.hitGroupId = hitGroupId
            self.hitId = hitId
            self.hitLayoutId = hitLayoutId
            self.hitReviewStatus = hitReviewStatus
            self.hitStatus = hitStatus
            self.hitTypeId = hitTypeId
            self.keywords = keywords
            self.maxAssignments = maxAssignments
            self.numberOfAssignmentsAvailable = numberOfAssignmentsAvailable
            self.numberOfAssignmentsCompleted = numberOfAssignmentsCompleted
            self.numberOfAssignmentsPending = numberOfAssignmentsPending
            self.qualificationRequirements = qualificationRequirements
            self.question = question
            self.requesterAnnotation = requesterAnnotation
            self.reward = reward
            self.title = title
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentDurationInSeconds = "AssignmentDurationInSeconds"
            case autoApprovalDelayInSeconds = "AutoApprovalDelayInSeconds"
            case creationTime = "CreationTime"
            case description = "Description"
            case expiration = "Expiration"
            case hitGroupId = "HITGroupId"
            case hitId = "HITId"
            case hitLayoutId = "HITLayoutId"
            case hitReviewStatus = "HITReviewStatus"
            case hitStatus = "HITStatus"
            case hitTypeId = "HITTypeId"
            case keywords = "Keywords"
            case maxAssignments = "MaxAssignments"
            case numberOfAssignmentsAvailable = "NumberOfAssignmentsAvailable"
            case numberOfAssignmentsCompleted = "NumberOfAssignmentsCompleted"
            case numberOfAssignmentsPending = "NumberOfAssignmentsPending"
            case qualificationRequirements = "QualificationRequirements"
            case question = "Question"
            case requesterAnnotation = "RequesterAnnotation"
            case reward = "Reward"
            case title = "Title"
        }
    }

    public struct HITLayoutParameter: AWSEncodableShape {
        ///  The name of the parameter in the HITLayout.
        public let name: String
        /// The value substituted for the parameter referenced in the HITLayout.
        public let value: String

        public init(name: String, value: String) {
            self.name = name
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case name = "Name"
            case value = "Value"
        }
    }

    public struct ListAssignmentsForHITRequest: AWSEncodableShape {
        /// The status of the assignments to return: Submitted | Approved | Rejected
        public let assignmentStatuses: [AssignmentStatus]?
        /// The ID of the HIT.
        public let hitId: String
        public let maxResults: Int?
        /// Pagination token
        public let nextToken: String?

        public init(assignmentStatuses: [AssignmentStatus]? = nil, hitId: String, maxResults: Int? = nil, nextToken: String? = nil) {
            self.assignmentStatuses = assignmentStatuses
            self.hitId = hitId
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentStatuses = "AssignmentStatuses"
            case hitId = "HITId"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListAssignmentsForHITResponse: AWSDecodableShape {
        ///  The collection of Assignment data structures returned by this call.
        public let assignments: [Assignment]?
        public let nextToken: String?
        ///  The number of assignments on the page in the filtered results list, equivalent to the number of assignments returned by this call.
        public let numResults: Int?

        public init(assignments: [Assignment]? = nil, nextToken: String? = nil, numResults: Int? = nil) {
            self.assignments = assignments
            self.nextToken = nextToken
            self.numResults = numResults
        }

        private enum CodingKeys: String, CodingKey {
            case assignments = "Assignments"
            case nextToken = "NextToken"
            case numResults = "NumResults"
        }
    }

    public struct ListBonusPaymentsRequest: AWSEncodableShape {
        /// The ID of the assignment associated with the bonus payments to retrieve. If specified, only bonus payments for the given assignment are returned. Either the HITId parameter or the AssignmentId parameter must be specified
        public let assignmentId: String?
        /// The ID of the HIT associated with the bonus payments to retrieve. If not specified, all bonus payments for all assignments for the given HIT are returned. Either the HITId parameter or the AssignmentId parameter must be specified
        public let hitId: String?
        public let maxResults: Int?
        /// Pagination token
        public let nextToken: String?

        public init(assignmentId: String? = nil, hitId: String? = nil, maxResults: Int? = nil, nextToken: String? = nil) {
            self.assignmentId = assignmentId
            self.hitId = hitId
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, max: 64)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, min: 1)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
            case hitId = "HITId"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListBonusPaymentsResponse: AWSDecodableShape {
        /// A successful request to the ListBonusPayments operation returns a list of BonusPayment objects.
        public let bonusPayments: [BonusPayment]?
        public let nextToken: String?
        /// The number of bonus payments on this page in the filtered results list, equivalent to the number of bonus payments being returned by this call.
        public let numResults: Int?

        public init(bonusPayments: [BonusPayment]? = nil, nextToken: String? = nil, numResults: Int? = nil) {
            self.bonusPayments = bonusPayments
            self.nextToken = nextToken
            self.numResults = numResults
        }

        private enum CodingKeys: String, CodingKey {
            case bonusPayments = "BonusPayments"
            case nextToken = "NextToken"
            case numResults = "NumResults"
        }
    }

    public struct ListHITsForQualificationTypeRequest: AWSEncodableShape {
        ///  Limit the number of results returned.
        public let maxResults: Int?
        /// Pagination Token
        public let nextToken: String?
        ///  The ID of the Qualification type to use when querying HITs.
        public let qualificationTypeId: String

        public init(maxResults: Int? = nil, nextToken: String? = nil, qualificationTypeId: String) {
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.qualificationTypeId = qualificationTypeId
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case qualificationTypeId = "QualificationTypeId"
        }
    }

    public struct ListHITsForQualificationTypeResponse: AWSDecodableShape {
        ///  The list of HIT elements returned by the query.
        public let hiTs: [HIT]?
        public let nextToken: String?
        ///  The number of HITs on this page in the filtered results list, equivalent to the number of HITs being returned by this call.
        public let numResults: Int?

        public init(hiTs: [HIT]? = nil, nextToken: String? = nil, numResults: Int? = nil) {
            self.hiTs = hiTs
            self.nextToken = nextToken
            self.numResults = numResults
        }

        private enum CodingKeys: String, CodingKey {
            case hiTs = "HITs"
            case nextToken = "NextToken"
            case numResults = "NumResults"
        }
    }

    public struct ListHITsRequest: AWSEncodableShape {
        public let maxResults: Int?
        /// Pagination token
        public let nextToken: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListHITsResponse: AWSDecodableShape {
        ///  The list of HIT elements returned by the query.
        public let hiTs: [HIT]?
        public let nextToken: String?
        /// The number of HITs on this page in the filtered results list, equivalent to the number of HITs being returned by this call.
        public let numResults: Int?

        public init(hiTs: [HIT]? = nil, nextToken: String? = nil, numResults: Int? = nil) {
            self.hiTs = hiTs
            self.nextToken = nextToken
            self.numResults = numResults
        }

        private enum CodingKeys: String, CodingKey {
            case hiTs = "HITs"
            case nextToken = "NextToken"
            case numResults = "NumResults"
        }
    }

    public struct ListQualificationRequestsRequest: AWSEncodableShape {
        ///  The maximum number of results to return in a single call.
        public let maxResults: Int?
        public let nextToken: String?
        /// The ID of the QualificationType.
        public let qualificationTypeId: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil, qualificationTypeId: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.qualificationTypeId = qualificationTypeId
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case qualificationTypeId = "QualificationTypeId"
        }
    }

    public struct ListQualificationRequestsResponse: AWSDecodableShape {
        public let nextToken: String?
        /// The number of Qualification requests on this page in the filtered results list, equivalent to the number of Qualification requests being returned by this call.
        public let numResults: Int?
        /// The Qualification request. The response includes one QualificationRequest element for each Qualification request returned by the query.
        public let qualificationRequests: [QualificationRequest]?

        public init(nextToken: String? = nil, numResults: Int? = nil, qualificationRequests: [QualificationRequest]? = nil) {
            self.nextToken = nextToken
            self.numResults = numResults
            self.qualificationRequests = qualificationRequests
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case numResults = "NumResults"
            case qualificationRequests = "QualificationRequests"
        }
    }

    public struct ListQualificationTypesRequest: AWSEncodableShape {
        ///  The maximum number of results to return in a single call.
        public let maxResults: Int?
        ///  Specifies that only Qualification types that the Requester created are returned. If false, the operation returns all Qualification types.
        public let mustBeOwnedByCaller: Bool?
        /// Specifies that only Qualification types that a user can request through the Amazon Mechanical Turk web site, such as by taking a Qualification test, are returned as results of the search. Some Qualification types, such as those assigned automatically by the system, cannot be requested directly by users. If false, all Qualification types, including those managed by the system, are considered. Valid values are True | False.
        public let mustBeRequestable: Bool
        public let nextToken: String?
        ///  A text query against all of the searchable attributes of Qualification types.
        public let query: String?

        public init(maxResults: Int? = nil, mustBeOwnedByCaller: Bool? = nil, mustBeRequestable: Bool, nextToken: String? = nil, query: String? = nil) {
            self.maxResults = maxResults
            self.mustBeOwnedByCaller = mustBeOwnedByCaller
            self.mustBeRequestable = mustBeRequestable
            self.nextToken = nextToken
            self.query = query
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case mustBeOwnedByCaller = "MustBeOwnedByCaller"
            case mustBeRequestable = "MustBeRequestable"
            case nextToken = "NextToken"
            case query = "Query"
        }
    }

    public struct ListQualificationTypesResponse: AWSDecodableShape {
        public let nextToken: String?
        ///  The number of Qualification types on this page in the filtered results list, equivalent to the number of types this operation returns.
        public let numResults: Int?
        ///  The list of QualificationType elements returned by the query.
        public let qualificationTypes: [QualificationType]?

        public init(nextToken: String? = nil, numResults: Int? = nil, qualificationTypes: [QualificationType]? = nil) {
            self.nextToken = nextToken
            self.numResults = numResults
            self.qualificationTypes = qualificationTypes
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case numResults = "NumResults"
            case qualificationTypes = "QualificationTypes"
        }
    }

    public struct ListReviewPolicyResultsForHITRequest: AWSEncodableShape {
        /// The unique identifier of the HIT to retrieve review results for.
        public let hitId: String
        /// Limit the number of results returned.
        public let maxResults: Int?
        /// Pagination token
        public let nextToken: String?
        ///  The Policy Level(s) to retrieve review results for - HIT or Assignment. If omitted, the default behavior is to retrieve all data for both policy levels. For a list of all the described policies, see Review Policies.
        public let policyLevels: [ReviewPolicyLevel]?
        ///  Specify if the operation should retrieve a list of the actions taken executing the Review Policies and their outcomes.
        public let retrieveActions: Bool?
        ///  Specify if the operation should retrieve a list of the results computed by the Review Policies.
        public let retrieveResults: Bool?

        public init(hitId: String, maxResults: Int? = nil, nextToken: String? = nil, policyLevels: [ReviewPolicyLevel]? = nil, retrieveActions: Bool? = nil, retrieveResults: Bool? = nil) {
            self.hitId = hitId
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.policyLevels = policyLevels
            self.retrieveActions = retrieveActions
            self.retrieveResults = retrieveResults
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case hitId = "HITId"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case policyLevels = "PolicyLevels"
            case retrieveActions = "RetrieveActions"
            case retrieveResults = "RetrieveResults"
        }
    }

    public struct ListReviewPolicyResultsForHITResponse: AWSDecodableShape {
        ///  The name of the Assignment-level Review Policy. This contains only the PolicyName element.
        public let assignmentReviewPolicy: ReviewPolicy?
        ///  Contains both ReviewResult and ReviewAction elements for an Assignment.
        public let assignmentReviewReport: ReviewReport?
        /// The HITId of the HIT for which results have been returned.
        public let hitId: String?
        /// The name of the HIT-level Review Policy. This contains only the PolicyName element.
        public let hitReviewPolicy: ReviewPolicy?
        /// Contains both ReviewResult and ReviewAction elements for a particular HIT.
        public let hitReviewReport: ReviewReport?
        public let nextToken: String?

        public init(assignmentReviewPolicy: ReviewPolicy? = nil, assignmentReviewReport: ReviewReport? = nil, hitId: String? = nil, hitReviewPolicy: ReviewPolicy? = nil, hitReviewReport: ReviewReport? = nil, nextToken: String? = nil) {
            self.assignmentReviewPolicy = assignmentReviewPolicy
            self.assignmentReviewReport = assignmentReviewReport
            self.hitId = hitId
            self.hitReviewPolicy = hitReviewPolicy
            self.hitReviewReport = hitReviewReport
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentReviewPolicy = "AssignmentReviewPolicy"
            case assignmentReviewReport = "AssignmentReviewReport"
            case hitId = "HITId"
            case hitReviewPolicy = "HITReviewPolicy"
            case hitReviewReport = "HITReviewReport"
            case nextToken = "NextToken"
        }
    }

    public struct ListReviewableHITsRequest: AWSEncodableShape {
        ///  The ID of the HIT type of the HITs to consider for the query. If not specified, all HITs for the Reviewer are considered
        public let hitTypeId: String?
        ///  Limit the number of results returned.
        public let maxResults: Int?
        /// Pagination Token
        public let nextToken: String?
        ///  Can be either Reviewable or Reviewing. Reviewable is the default value.
        public let status: ReviewableHITStatus?

        public init(hitTypeId: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, status: ReviewableHITStatus? = nil) {
            self.hitTypeId = hitTypeId
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.status = status
        }

        public func validate(name: String) throws {
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, max: 64)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, min: 1)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case hitTypeId = "HITTypeId"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case status = "Status"
        }
    }

    public struct ListReviewableHITsResponse: AWSDecodableShape {
        ///  The list of HIT elements returned by the query.
        public let hiTs: [HIT]?
        public let nextToken: String?
        ///  The number of HITs on this page in the filtered results list, equivalent to the number of HITs being returned by this call.
        public let numResults: Int?

        public init(hiTs: [HIT]? = nil, nextToken: String? = nil, numResults: Int? = nil) {
            self.hiTs = hiTs
            self.nextToken = nextToken
            self.numResults = numResults
        }

        private enum CodingKeys: String, CodingKey {
            case hiTs = "HITs"
            case nextToken = "NextToken"
            case numResults = "NumResults"
        }
    }

    public struct ListWorkerBlocksRequest: AWSEncodableShape {
        public let maxResults: Int?
        /// Pagination token
        public let nextToken: String?

        public init(maxResults: Int? = nil, nextToken: String? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
        }
    }

    public struct ListWorkerBlocksResponse: AWSDecodableShape {
        public let nextToken: String?
        ///  The number of assignments on the page in the filtered results list, equivalent to the number of assignments returned by this call.
        public let numResults: Int?
        ///  The list of WorkerBlocks, containing the collection of Worker IDs and reasons for blocking.
        public let workerBlocks: [WorkerBlock]?

        public init(nextToken: String? = nil, numResults: Int? = nil, workerBlocks: [WorkerBlock]? = nil) {
            self.nextToken = nextToken
            self.numResults = numResults
            self.workerBlocks = workerBlocks
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case numResults = "NumResults"
            case workerBlocks = "WorkerBlocks"
        }
    }

    public struct ListWorkersWithQualificationTypeRequest: AWSEncodableShape {
        ///  Limit the number of results returned.
        public let maxResults: Int?
        /// Pagination Token
        public let nextToken: String?
        /// The ID of the Qualification type of the Qualifications to return.
        public let qualificationTypeId: String
        ///  The status of the Qualifications to return. Can be Granted | Revoked.
        public let status: QualificationStatus?

        public init(maxResults: Int? = nil, nextToken: String? = nil, qualificationTypeId: String, status: QualificationStatus? = nil) {
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.qualificationTypeId = qualificationTypeId
            self.status = status
        }

        public func validate(name: String) throws {
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 1)
            try self.validate(self.nextToken, name: "nextToken", parent: name, max: 255)
            try self.validate(self.nextToken, name: "nextToken", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case qualificationTypeId = "QualificationTypeId"
            case status = "Status"
        }
    }

    public struct ListWorkersWithQualificationTypeResponse: AWSDecodableShape {
        public let nextToken: String?
        ///  The number of Qualifications on this page in the filtered results list, equivalent to the number of Qualifications being returned by this call.
        public let numResults: Int?
        ///  The list of Qualification elements returned by this call.
        public let qualifications: [Qualification]?

        public init(nextToken: String? = nil, numResults: Int? = nil, qualifications: [Qualification]? = nil) {
            self.nextToken = nextToken
            self.numResults = numResults
            self.qualifications = qualifications
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case numResults = "NumResults"
            case qualifications = "Qualifications"
        }
    }

    public struct Locale: AWSEncodableShape & AWSDecodableShape {
        ///  The country of the locale. Must be a valid ISO 3166 country code. For example, the code US refers to the United States of America.
        public let country: String
        /// The state or subdivision of the locale. A valid ISO 3166-2 subdivision code. For example, the code WA refers to the state of Washington.
        public let subdivision: String?

        public init(country: String, subdivision: String? = nil) {
            self.country = country
            self.subdivision = subdivision
        }

        public func validate(name: String) throws {
            try self.validate(self.country, name: "country", parent: name, max: 2)
            try self.validate(self.country, name: "country", parent: name, min: 2)
            try self.validate(self.subdivision, name: "subdivision", parent: name, max: 2)
            try self.validate(self.subdivision, name: "subdivision", parent: name, min: 2)
        }

        private enum CodingKeys: String, CodingKey {
            case country = "Country"
            case subdivision = "Subdivision"
        }
    }

    public struct NotificationSpecification: AWSEncodableShape {
        ///  The target for notification messages. The Destination’s format is determined by the specified Transport:    When Transport is Email, the Destination is your email address.   When Transport is SQS, the Destination is your queue URL.   When Transport is SNS, the Destination is the ARN of your topic.
        public let destination: String
        ///  The list of events that should cause notifications to be sent. Valid Values: AssignmentAccepted | AssignmentAbandoned | AssignmentReturned | AssignmentSubmitted | AssignmentRejected | AssignmentApproved | HITCreated | HITExtended | HITDisposed | HITReviewable | HITExpired | Ping. The Ping event is only valid for the SendTestEventNotification operation.
        public let eventTypes: [EventType]
        ///  The method Amazon Mechanical Turk uses to send the notification. Valid Values: Email | SQS | SNS.
        public let transport: NotificationTransport
        /// The version of the Notification API to use. Valid value is 2006-05-05.
        public let version: String

        public init(destination: String, eventTypes: [EventType], transport: NotificationTransport, version: String) {
            self.destination = destination
            self.eventTypes = eventTypes
            self.transport = transport
            self.version = version
        }

        private enum CodingKeys: String, CodingKey {
            case destination = "Destination"
            case eventTypes = "EventTypes"
            case transport = "Transport"
            case version = "Version"
        }
    }

    public struct NotifyWorkersFailureStatus: AWSDecodableShape {
        ///  Encoded value for the failure type.
        public let notifyWorkersFailureCode: NotifyWorkersFailureCode?
        ///  A message detailing the reason the Worker could not be notified.
        public let notifyWorkersFailureMessage: String?
        ///  The ID of the Worker.
        public let workerId: String?

        public init(notifyWorkersFailureCode: NotifyWorkersFailureCode? = nil, notifyWorkersFailureMessage: String? = nil, workerId: String? = nil) {
            self.notifyWorkersFailureCode = notifyWorkersFailureCode
            self.notifyWorkersFailureMessage = notifyWorkersFailureMessage
            self.workerId = workerId
        }

        private enum CodingKeys: String, CodingKey {
            case notifyWorkersFailureCode = "NotifyWorkersFailureCode"
            case notifyWorkersFailureMessage = "NotifyWorkersFailureMessage"
            case workerId = "WorkerId"
        }
    }

    public struct NotifyWorkersRequest: AWSEncodableShape {
        /// The text of the email message to send. Can include up to 4,096 characters
        public let messageText: String
        /// The subject line of the email message to send. Can include up to 200 characters.
        public let subject: String
        /// A list of Worker IDs you wish to notify. You can notify upto 100 Workers at a time.
        public let workerIds: [String]

        public init(messageText: String, subject: String, workerIds: [String]) {
            self.messageText = messageText
            self.subject = subject
            self.workerIds = workerIds
        }

        public func validate(name: String) throws {
            try self.workerIds.forEach {
                try validate($0, name: "workerIds[]", parent: name, max: 64)
                try validate($0, name: "workerIds[]", parent: name, min: 1)
                try validate($0, name: "workerIds[]", parent: name, pattern: "^A[A-Z0-9]+$")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case messageText = "MessageText"
            case subject = "Subject"
            case workerIds = "WorkerIds"
        }
    }

    public struct NotifyWorkersResponse: AWSDecodableShape {
        ///  When MTurk sends notifications to the list of Workers, it returns back any failures it encounters in this list of NotifyWorkersFailureStatus objects.
        public let notifyWorkersFailureStatuses: [NotifyWorkersFailureStatus]?

        public init(notifyWorkersFailureStatuses: [NotifyWorkersFailureStatus]? = nil) {
            self.notifyWorkersFailureStatuses = notifyWorkersFailureStatuses
        }

        private enum CodingKeys: String, CodingKey {
            case notifyWorkersFailureStatuses = "NotifyWorkersFailureStatuses"
        }
    }

    public struct ParameterMapEntry: AWSEncodableShape & AWSDecodableShape {
        ///  The QuestionID from the HIT that is used to identify which question requires Mechanical Turk to score as part of the ScoreMyKnownAnswers/2011-09-01 Review Policy.
        public let key: String?
        ///  The list of answers to the question specified in the MapEntry Key element. The Worker must match all values in order for the answer to be scored correctly.
        public let values: [String]?

        public init(key: String? = nil, values: [String]? = nil) {
            self.key = key
            self.values = values
        }

        private enum CodingKeys: String, CodingKey {
            case key = "Key"
            case values = "Values"
        }
    }

    public struct PolicyParameter: AWSEncodableShape & AWSDecodableShape {
        ///  Name of the parameter from the list of Review Polices.
        public let key: String?
        ///  List of ParameterMapEntry objects.
        public let mapEntries: [ParameterMapEntry]?
        ///  The list of values of the Parameter
        public let values: [String]?

        public init(key: String? = nil, mapEntries: [ParameterMapEntry]? = nil, values: [String]? = nil) {
            self.key = key
            self.mapEntries = mapEntries
            self.values = values
        }

        private enum CodingKeys: String, CodingKey {
            case key = "Key"
            case mapEntries = "MapEntries"
            case values = "Values"
        }
    }

    public struct Qualification: AWSDecodableShape {
        ///  The date and time the Qualification was granted to the Worker. If the Worker's Qualification was revoked, and then re-granted based on a new Qualification request, GrantTime is the date and time of the last call to the AcceptQualificationRequest operation.
        public let grantTime: Date?
        ///  The value (score) of the Qualification, if the Qualification has an integer value.
        public let integerValue: Int?
        public let localeValue: Locale?
        ///  The ID of the Qualification type for the Qualification.
        public let qualificationTypeId: String?
        ///  The status of the Qualification. Valid values are Granted | Revoked.
        public let status: QualificationStatus?
        ///  The ID of the Worker who possesses the Qualification.
        public let workerId: String?

        public init(grantTime: Date? = nil, integerValue: Int? = nil, localeValue: Locale? = nil, qualificationTypeId: String? = nil, status: QualificationStatus? = nil, workerId: String? = nil) {
            self.grantTime = grantTime
            self.integerValue = integerValue
            self.localeValue = localeValue
            self.qualificationTypeId = qualificationTypeId
            self.status = status
            self.workerId = workerId
        }

        private enum CodingKeys: String, CodingKey {
            case grantTime = "GrantTime"
            case integerValue = "IntegerValue"
            case localeValue = "LocaleValue"
            case qualificationTypeId = "QualificationTypeId"
            case status = "Status"
            case workerId = "WorkerId"
        }
    }

    public struct QualificationRequest: AWSDecodableShape {
        ///  The Worker's answers for the Qualification type's test contained in a QuestionFormAnswers document, if the type has a test and the Worker has submitted answers. If the Worker does not provide any answers, Answer may be empty.
        public let answer: String?
        /// The ID of the Qualification request, a unique identifier generated when the request was submitted.
        ///
        public let qualificationRequestId: String?
        ///  The ID of the Qualification type the Worker is requesting, as returned by the CreateQualificationType operation.
        public let qualificationTypeId: String?
        /// The date and time the Qualification request had a status of Submitted. This is either the time the Worker submitted answers for a Qualification test, or the time the Worker requested the Qualification if the Qualification type does not have a test.
        public let submitTime: Date?
        ///  The contents of the Qualification test that was presented to the Worker, if the type has a test and the Worker has submitted answers. This value is identical to the QuestionForm associated with the Qualification type at the time the Worker requests the Qualification.
        public let test: String?
        ///  The ID of the Worker requesting the Qualification.
        public let workerId: String?

        public init(answer: String? = nil, qualificationRequestId: String? = nil, qualificationTypeId: String? = nil, submitTime: Date? = nil, test: String? = nil, workerId: String? = nil) {
            self.answer = answer
            self.qualificationRequestId = qualificationRequestId
            self.qualificationTypeId = qualificationTypeId
            self.submitTime = submitTime
            self.test = test
            self.workerId = workerId
        }

        private enum CodingKeys: String, CodingKey {
            case answer = "Answer"
            case qualificationRequestId = "QualificationRequestId"
            case qualificationTypeId = "QualificationTypeId"
            case submitTime = "SubmitTime"
            case test = "Test"
            case workerId = "WorkerId"
        }
    }

    public struct QualificationRequirement: AWSEncodableShape & AWSDecodableShape {
        ///  Setting this attribute prevents Workers whose Qualifications do not meet this QualificationRequirement from taking the specified action. Valid arguments include "Accept" (Worker cannot accept the HIT, but can preview the HIT and see it in their search results), "PreviewAndAccept" (Worker cannot accept or preview the HIT, but can see the HIT in their search results), and "DiscoverPreviewAndAccept" (Worker cannot accept, preview, or see the HIT in their search results). It's possible for you to create a HIT with multiple QualificationRequirements (which can have different values for the ActionGuarded attribute). In this case, the Worker is only permitted to perform an action when they have met all QualificationRequirements guarding the action. The actions in the order of least restrictive to most restrictive are Discover, Preview and Accept. For example, if a Worker meets all QualificationRequirements that are set to DiscoverPreviewAndAccept, but do not meet all requirements that are set with PreviewAndAccept, then the Worker will be able to Discover, i.e. see the HIT in their search result, but will not be able to Preview or Accept the HIT. ActionsGuarded should not be used in combination with the RequiredToPreview field.
        public let actionsGuarded: HITAccessActions?
        /// The kind of comparison to make against a Qualification's value. You can compare a Qualification's value to an IntegerValue to see if it is LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, EqualTo, or NotEqualTo the IntegerValue. You can compare it to a LocaleValue to see if it is EqualTo, or NotEqualTo the LocaleValue. You can check to see if the value is In or NotIn a set of IntegerValue or LocaleValue values. Lastly, a Qualification requirement can also test if a Qualification Exists or DoesNotExist in the user's profile, regardless of its value.
        public let comparator: Comparator
        ///  The integer value to compare against the Qualification's value. IntegerValue must not be present if Comparator is Exists or DoesNotExist. IntegerValue can only be used if the Qualification type has an integer value; it cannot be used with the Worker_Locale QualificationType ID. When performing a set comparison by using the In or the NotIn comparator, you can use up to 15 IntegerValue elements in a QualificationRequirement data structure.
        public let integerValues: [Int]?
        ///  The locale value to compare against the Qualification's value. The local value must be a valid ISO 3166 country code or supports ISO 3166-2 subdivisions. LocaleValue can only be used with a Worker_Locale QualificationType ID. LocaleValue can only be used with the EqualTo, NotEqualTo, In, and NotIn comparators. You must only use a single LocaleValue element when using the EqualTo or NotEqualTo comparators. When performing a set comparison by using the In or the NotIn comparator, you can use up to 30 LocaleValue elements in a QualificationRequirement data structure.
        public let localeValues: [Locale]?
        ///  The ID of the Qualification type for the requirement.
        public let qualificationTypeId: String
        ///  DEPRECATED: Use the ActionsGuarded field instead. If RequiredToPreview is true, the question data for the HIT will not be shown when a Worker whose Qualifications do not meet this requirement tries to preview the HIT. That is, a Worker's Qualifications must meet all of the requirements for which RequiredToPreview is true in order to preview the HIT. If a Worker meets all of the requirements where RequiredToPreview is true (or if there are no such requirements), but does not meet all of the requirements for the HIT, the Worker will be allowed to preview the HIT's question data, but will not be allowed to accept and complete the HIT. The default is false. This should not be used in combination with the ActionsGuarded field.
        public let requiredToPreview: Bool?

        public init(actionsGuarded: HITAccessActions? = nil, comparator: Comparator, integerValues: [Int]? = nil, localeValues: [Locale]? = nil, qualificationTypeId: String) {
            self.actionsGuarded = actionsGuarded
            self.comparator = comparator
            self.integerValues = integerValues
            self.localeValues = localeValues
            self.qualificationTypeId = qualificationTypeId
            self.requiredToPreview = nil
        }

        @available(*, deprecated, message: "Members requiredToPreview have been deprecated")
        public init(actionsGuarded: HITAccessActions? = nil, comparator: Comparator, integerValues: [Int]? = nil, localeValues: [Locale]? = nil, qualificationTypeId: String, requiredToPreview: Bool? = nil) {
            self.actionsGuarded = actionsGuarded
            self.comparator = comparator
            self.integerValues = integerValues
            self.localeValues = localeValues
            self.qualificationTypeId = qualificationTypeId
            self.requiredToPreview = requiredToPreview
        }

        public func validate(name: String) throws {
            try self.localeValues?.forEach {
                try $0.validate(name: "\(name).localeValues[]")
            }
        }

        private enum CodingKeys: String, CodingKey {
            case actionsGuarded = "ActionsGuarded"
            case comparator = "Comparator"
            case integerValues = "IntegerValues"
            case localeValues = "LocaleValues"
            case qualificationTypeId = "QualificationTypeId"
            case requiredToPreview = "RequiredToPreview"
        }
    }

    public struct QualificationType: AWSDecodableShape {
        /// The answers to the Qualification test specified in the Test parameter.
        public let answerKey: String?
        /// Specifies that requests for the Qualification type are granted immediately, without prompting the Worker with a Qualification test. Valid values are True | False.
        public let autoGranted: Bool?
        ///  The Qualification integer value to use for automatically granted Qualifications, if AutoGranted is true. This is 1 by default.
        public let autoGrantedValue: Int?
        ///  The date and time the Qualification type was created.
        public let creationTime: Date?
        ///  A long description for the Qualification type.
        public let description: String?
        ///  Specifies whether the Qualification type is one that a user can request through the Amazon Mechanical Turk web site, such as by taking a Qualification test. This value is False for Qualifications assigned automatically by the system. Valid values are True | False.
        public let isRequestable: Bool?
        ///  One or more words or phrases that describe theQualification type, separated by commas. The Keywords make the type easier to find using a search.
        public let keywords: String?
        ///  The name of the Qualification type. The type name is used to identify the type, and to find the type using a Qualification type search.
        public let name: String?
        ///  A unique identifier for the Qualification type. A Qualification type is given a Qualification type ID when you call the CreateQualificationType operation.
        public let qualificationTypeId: String?
        ///  The status of the Qualification type. A Qualification type's status determines if users can apply to receive a Qualification of this type, and if HITs can be created with requirements based on this type. Valid values are Active | Inactive.
        public let qualificationTypeStatus: QualificationTypeStatus?
        ///  The amount of time, in seconds, Workers must wait after taking the Qualification test before they can take it again. Workers can take a Qualification test multiple times if they were not granted the Qualification from a previous attempt, or if the test offers a gradient score and they want a better score. If not specified, retries are disabled and Workers can request a Qualification only once.
        public let retryDelayInSeconds: Int64?
        ///  The questions for a Qualification test associated with this Qualification type that a user can take to obtain a Qualification of this type. This parameter must be specified if AnswerKey is present. A Qualification type cannot have both a specified Test parameter and an AutoGranted value of true.
        public let test: String?
        ///  The amount of time, in seconds, given to a Worker to complete the Qualification test, beginning from the time the Worker requests the Qualification.
        public let testDurationInSeconds: Int64?

        public init(answerKey: String? = nil, autoGranted: Bool? = nil, autoGrantedValue: Int? = nil, creationTime: Date? = nil, description: String? = nil, isRequestable: Bool? = nil, keywords: String? = nil, name: String? = nil, qualificationTypeId: String? = nil, qualificationTypeStatus: QualificationTypeStatus? = nil, retryDelayInSeconds: Int64? = nil, test: String? = nil, testDurationInSeconds: Int64? = nil) {
            self.answerKey = answerKey
            self.autoGranted = autoGranted
            self.autoGrantedValue = autoGrantedValue
            self.creationTime = creationTime
            self.description = description
            self.isRequestable = isRequestable
            self.keywords = keywords
            self.name = name
            self.qualificationTypeId = qualificationTypeId
            self.qualificationTypeStatus = qualificationTypeStatus
            self.retryDelayInSeconds = retryDelayInSeconds
            self.test = test
            self.testDurationInSeconds = testDurationInSeconds
        }

        private enum CodingKeys: String, CodingKey {
            case answerKey = "AnswerKey"
            case autoGranted = "AutoGranted"
            case autoGrantedValue = "AutoGrantedValue"
            case creationTime = "CreationTime"
            case description = "Description"
            case isRequestable = "IsRequestable"
            case keywords = "Keywords"
            case name = "Name"
            case qualificationTypeId = "QualificationTypeId"
            case qualificationTypeStatus = "QualificationTypeStatus"
            case retryDelayInSeconds = "RetryDelayInSeconds"
            case test = "Test"
            case testDurationInSeconds = "TestDurationInSeconds"
        }
    }

    public struct RejectAssignmentRequest: AWSEncodableShape {
        ///  The ID of the assignment. The assignment must correspond to a HIT created by the Requester.
        public let assignmentId: String
        ///  A message for the Worker, which the Worker can see in the Status section of the web site.
        public let requesterFeedback: String

        public init(assignmentId: String, requesterFeedback: String) {
            self.assignmentId = assignmentId
            self.requesterFeedback = requesterFeedback
        }

        public func validate(name: String) throws {
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, max: 64)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, min: 1)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
            case requesterFeedback = "RequesterFeedback"
        }
    }

    public struct RejectAssignmentResponse: AWSDecodableShape {
        public init() {}
    }

    public struct RejectQualificationRequestRequest: AWSEncodableShape {
        ///  The ID of the Qualification request, as returned by the ListQualificationRequests operation.
        public let qualificationRequestId: String
        /// A text message explaining why the request was rejected, to be shown to the Worker who made the request.
        public let reason: String?

        public init(qualificationRequestId: String, reason: String? = nil) {
            self.qualificationRequestId = qualificationRequestId
            self.reason = reason
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationRequestId = "QualificationRequestId"
            case reason = "Reason"
        }
    }

    public struct RejectQualificationRequestResponse: AWSDecodableShape {
        public init() {}
    }

    public struct ReviewActionDetail: AWSDecodableShape {
        /// The unique identifier for the action.
        public let actionId: String?
        ///  The nature of the action itself. The Review Policy is responsible for examining the HIT and Assignments, emitting results, and deciding which other actions will be necessary.
        public let actionName: String?
        ///  The date when the action was completed.
        public let completeTime: Date?
        ///  Present only when the Results have a FAILED Status.
        public let errorCode: String?
        ///  A description of the outcome of the review.
        public let result: String?
        ///  The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED.
        public let status: ReviewActionStatus?
        ///  The specific HITId or AssignmentID targeted by the action.
        public let targetId: String?
        ///  The type of object in TargetId.
        public let targetType: String?

        public init(actionId: String? = nil, actionName: String? = nil, completeTime: Date? = nil, errorCode: String? = nil, result: String? = nil, status: ReviewActionStatus? = nil, targetId: String? = nil, targetType: String? = nil) {
            self.actionId = actionId
            self.actionName = actionName
            self.completeTime = completeTime
            self.errorCode = errorCode
            self.result = result
            self.status = status
            self.targetId = targetId
            self.targetType = targetType
        }

        private enum CodingKeys: String, CodingKey {
            case actionId = "ActionId"
            case actionName = "ActionName"
            case completeTime = "CompleteTime"
            case errorCode = "ErrorCode"
            case result = "Result"
            case status = "Status"
            case targetId = "TargetId"
            case targetType = "TargetType"
        }
    }

    public struct ReviewPolicy: AWSEncodableShape & AWSDecodableShape {
        /// Name of the parameter from the Review policy.
        public let parameters: [PolicyParameter]?
        ///  Name of a Review Policy: SimplePlurality/2011-09-01 or ScoreMyKnownAnswers/2011-09-01
        public let policyName: String

        public init(parameters: [PolicyParameter]? = nil, policyName: String) {
            self.parameters = parameters
            self.policyName = policyName
        }

        private enum CodingKeys: String, CodingKey {
            case parameters = "Parameters"
            case policyName = "PolicyName"
        }
    }

    public struct ReviewReport: AWSDecodableShape {
        ///  A list of ReviewAction objects for each action specified in the Review Policy.
        public let reviewActions: [ReviewActionDetail]?
        ///  A list of ReviewResults objects for each action specified in the Review Policy.
        public let reviewResults: [ReviewResultDetail]?

        public init(reviewActions: [ReviewActionDetail]? = nil, reviewResults: [ReviewResultDetail]? = nil) {
            self.reviewActions = reviewActions
            self.reviewResults = reviewResults
        }

        private enum CodingKeys: String, CodingKey {
            case reviewActions = "ReviewActions"
            case reviewResults = "ReviewResults"
        }
    }

    public struct ReviewResultDetail: AWSDecodableShape {
        ///  A unique identifier of the Review action result.
        public let actionId: String?
        ///  Key identifies the particular piece of reviewed information.
        public let key: String?
        ///  Specifies the QuestionId the result is describing. Depending on whether the TargetType is a HIT or Assignment this results could specify multiple values. If TargetType is HIT and QuestionId is absent, then the result describes results of the HIT, including the HIT agreement score. If ObjectType is Assignment and QuestionId is absent, then the result describes the Worker's performance on the HIT.
        public let questionId: String?
        /// The HITID or AssignmentId about which this result was taken. Note that HIT-level Review Policies will often emit results about both the HIT itself and its Assignments, while Assignment-level review policies generally only emit results about the Assignment itself.
        public let subjectId: String?
        ///  The type of the object from the SubjectId field.
        public let subjectType: String?
        ///  The values of Key provided by the review policies you have selected.
        public let value: String?

        public init(actionId: String? = nil, key: String? = nil, questionId: String? = nil, subjectId: String? = nil, subjectType: String? = nil, value: String? = nil) {
            self.actionId = actionId
            self.key = key
            self.questionId = questionId
            self.subjectId = subjectId
            self.subjectType = subjectType
            self.value = value
        }

        private enum CodingKeys: String, CodingKey {
            case actionId = "ActionId"
            case key = "Key"
            case questionId = "QuestionId"
            case subjectId = "SubjectId"
            case subjectType = "SubjectType"
            case value = "Value"
        }
    }

    public struct SendBonusRequest: AWSEncodableShape {
        /// The ID of the assignment for which this bonus is paid.
        public let assignmentId: String
        ///  The Bonus amount is a US Dollar amount specified using a string (for example, "5" represents $5.00 USD and "101.42" represents $101.42 USD). Do not include currency symbols or currency codes.
        public let bonusAmount: String
        /// A message that explains the reason for the bonus payment. The Worker receiving the bonus can see this message.
        public let reason: String
        /// A unique identifier for this request, which allows you to retry the call on error without granting multiple bonuses. This is useful in cases such as network timeouts where it is unclear whether or not the call succeeded on the server. If the bonus already exists in the system from a previous call using the same UniqueRequestToken, subsequent calls will return an error with a message containing the request ID.
        public let uniqueRequestToken: String?
        /// The ID of the Worker being paid the bonus.
        public let workerId: String

        public init(assignmentId: String, bonusAmount: String, reason: String, uniqueRequestToken: String? = nil, workerId: String) {
            self.assignmentId = assignmentId
            self.bonusAmount = bonusAmount
            self.reason = reason
            self.uniqueRequestToken = uniqueRequestToken
            self.workerId = workerId
        }

        public func validate(name: String) throws {
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, max: 64)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, min: 1)
            try self.validate(self.assignmentId, name: "assignmentId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.bonusAmount, name: "bonusAmount", parent: name, pattern: "^[0-9]+(\\.)?[0-9]{0,2}$")
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, max: 64)
            try self.validate(self.uniqueRequestToken, name: "uniqueRequestToken", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, max: 64)
            try self.validate(self.workerId, name: "workerId", parent: name, min: 1)
            try self.validate(self.workerId, name: "workerId", parent: name, pattern: "^A[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case assignmentId = "AssignmentId"
            case bonusAmount = "BonusAmount"
            case reason = "Reason"
            case uniqueRequestToken = "UniqueRequestToken"
            case workerId = "WorkerId"
        }
    }

    public struct SendBonusResponse: AWSDecodableShape {
        public init() {}
    }

    public struct SendTestEventNotificationRequest: AWSEncodableShape {
        ///  The notification specification to test. This value is identical to the value you would provide to the UpdateNotificationSettings operation when you establish the notification specification for a HIT type.
        public let notification: NotificationSpecification
        ///  The event to simulate to test the notification specification. This event is included in the test message even if the notification specification does not include the event type. The notification specification does not filter out the test event.
        public let testEventType: EventType

        public init(notification: NotificationSpecification, testEventType: EventType) {
            self.notification = notification
            self.testEventType = testEventType
        }

        private enum CodingKeys: String, CodingKey {
            case notification = "Notification"
            case testEventType = "TestEventType"
        }
    }

    public struct SendTestEventNotificationResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateExpirationForHITRequest: AWSEncodableShape {
        ///  The date and time at which you want the HIT to expire
        public let expireAt: Date
        ///  The HIT to update.
        public let hitId: String

        public init(expireAt: Date, hitId: String) {
            self.expireAt = expireAt
            self.hitId = hitId
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case expireAt = "ExpireAt"
            case hitId = "HITId"
        }
    }

    public struct UpdateExpirationForHITResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateHITReviewStatusRequest: AWSEncodableShape {
        ///  The ID of the HIT to update.
        public let hitId: String
        ///  Specifies how to update the HIT status. Default is False.     Setting this to false will only transition a HIT from Reviewable to Reviewing     Setting this to true will only transition a HIT from Reviewing to Reviewable
        public let revert: Bool?

        public init(hitId: String, revert: Bool? = nil) {
            self.hitId = hitId
            self.revert = revert
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case hitId = "HITId"
            case revert = "Revert"
        }
    }

    public struct UpdateHITReviewStatusResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateHITTypeOfHITRequest: AWSEncodableShape {
        /// The HIT to update.
        public let hitId: String
        /// The ID of the new HIT type.
        public let hitTypeId: String

        public init(hitId: String, hitTypeId: String) {
            self.hitId = hitId
            self.hitTypeId = hitTypeId
        }

        public func validate(name: String) throws {
            try self.validate(self.hitId, name: "hitId", parent: name, max: 64)
            try self.validate(self.hitId, name: "hitId", parent: name, min: 1)
            try self.validate(self.hitId, name: "hitId", parent: name, pattern: "^[A-Z0-9]+$")
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, max: 64)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, min: 1)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case hitId = "HITId"
            case hitTypeId = "HITTypeId"
        }
    }

    public struct UpdateHITTypeOfHITResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateNotificationSettingsRequest: AWSEncodableShape {
        ///  Specifies whether notifications are sent for HITs of this HIT type, according to the notification specification. You must specify either the Notification parameter or the Active parameter for the call to UpdateNotificationSettings to succeed.
        public let active: Bool?
        ///  The ID of the HIT type whose notification specification is being updated.
        public let hitTypeId: String
        ///  The notification specification for the HIT type.
        public let notification: NotificationSpecification?

        public init(active: Bool? = nil, hitTypeId: String, notification: NotificationSpecification? = nil) {
            self.active = active
            self.hitTypeId = hitTypeId
            self.notification = notification
        }

        public func validate(name: String) throws {
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, max: 64)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, min: 1)
            try self.validate(self.hitTypeId, name: "hitTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case active = "Active"
            case hitTypeId = "HITTypeId"
            case notification = "Notification"
        }
    }

    public struct UpdateNotificationSettingsResponse: AWSDecodableShape {
        public init() {}
    }

    public struct UpdateQualificationTypeRequest: AWSEncodableShape {
        /// The answers to the Qualification test specified in the Test parameter, in the form of an AnswerKey data structure.
        public let answerKey: String?
        /// Specifies whether requests for the Qualification type are granted immediately, without prompting the Worker with a Qualification test. Constraints: If the Test parameter is specified, this parameter cannot be true.
        public let autoGranted: Bool?
        /// The Qualification value to use for automatically granted Qualifications. This parameter is used only if the AutoGranted parameter is true.
        public let autoGrantedValue: Int?
        /// The new description of the Qualification type.
        public let description: String?
        /// The ID of the Qualification type to update.
        public let qualificationTypeId: String
        /// The new status of the Qualification type - Active | Inactive
        public let qualificationTypeStatus: QualificationTypeStatus?
        /// The amount of time, in seconds, that Workers must wait after requesting a Qualification of the specified Qualification type before they can retry the Qualification request. It is not possible to disable retries for a Qualification type after it has been created with retries enabled. If you want to disable retries, you must dispose of the existing retry-enabled Qualification type using DisposeQualificationType and then create a new Qualification type with retries disabled using CreateQualificationType.
        public let retryDelayInSeconds: Int64?
        /// The questions for the Qualification test a Worker must answer correctly to obtain a Qualification of this type. If this parameter is specified, TestDurationInSeconds must also be specified. Constraints: Must not be longer than 65535 bytes. Must be a QuestionForm data structure. This parameter cannot be specified if AutoGranted is true. Constraints: None. If not specified, the Worker may request the Qualification without answering any questions.
        public let test: String?
        /// The number of seconds the Worker has to complete the Qualification test, starting from the time the Worker requests the Qualification.
        public let testDurationInSeconds: Int64?

        public init(answerKey: String? = nil, autoGranted: Bool? = nil, autoGrantedValue: Int? = nil, description: String? = nil, qualificationTypeId: String, qualificationTypeStatus: QualificationTypeStatus? = nil, retryDelayInSeconds: Int64? = nil, test: String? = nil, testDurationInSeconds: Int64? = nil) {
            self.answerKey = answerKey
            self.autoGranted = autoGranted
            self.autoGrantedValue = autoGrantedValue
            self.description = description
            self.qualificationTypeId = qualificationTypeId
            self.qualificationTypeStatus = qualificationTypeStatus
            self.retryDelayInSeconds = retryDelayInSeconds
            self.test = test
            self.testDurationInSeconds = testDurationInSeconds
        }

        public func validate(name: String) throws {
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, max: 64)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, min: 1)
            try self.validate(self.qualificationTypeId, name: "qualificationTypeId", parent: name, pattern: "^[A-Z0-9]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case answerKey = "AnswerKey"
            case autoGranted = "AutoGranted"
            case autoGrantedValue = "AutoGrantedValue"
            case description = "Description"
            case qualificationTypeId = "QualificationTypeId"
            case qualificationTypeStatus = "QualificationTypeStatus"
            case retryDelayInSeconds = "RetryDelayInSeconds"
            case test = "Test"
            case testDurationInSeconds = "TestDurationInSeconds"
        }
    }

    public struct UpdateQualificationTypeResponse: AWSDecodableShape {
        ///  Contains a QualificationType data structure.
        public let qualificationType: QualificationType?

        public init(qualificationType: QualificationType? = nil) {
            self.qualificationType = qualificationType
        }

        private enum CodingKeys: String, CodingKey {
            case qualificationType = "QualificationType"
        }
    }

    public struct WorkerBlock: AWSDecodableShape {
        ///  A message explaining the reason the Worker was blocked.
        public let reason: String?
        ///  The ID of the Worker who accepted the HIT.
        public let workerId: String?

        public init(reason: String? = nil, workerId: String? = nil) {
            self.reason = reason
            self.workerId = workerId
        }

        private enum CodingKeys: String, CodingKey {
            case reason = "Reason"
            case workerId = "WorkerId"
        }
    }
}

// MARK: - Errors

/// Error enum for MTurk
public struct MTurkErrorType: AWSErrorType {
    enum Code: String {
        case requestError = "RequestError"
        case serviceFault = "ServiceFault"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize MTurk
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// Your request is invalid.
    public static var requestError: Self { .init(.requestError) }
    /// Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.
    public static var serviceFault: Self { .init(.serviceFault) }
}

extension MTurkErrorType: Equatable {
    public static func == (lhs: MTurkErrorType, rhs: MTurkErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension MTurkErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
